<template>
	<view>
		<navbar :navcolor="navColor" :name="name"></navbar>
		<videoList :list="list"></videoList>
		<uni-load-more v-if="loadModal === false" iconType="auto" :status="loadStatus"></uni-load-more>
		<loadModal :loading="loadModal"></loadModal>
	</view>
</template>

<script>
	// easyCom功能可替换import components/组件名/组件名.vue	局部引入
	export default {
		data() {
			return {
				name: '物理',
				navColor: '#0081ff',
				loadModal: true,
				loadStatus: "loading",
				list: [],
				page: 1,
				pageSize: 5
			}
		},
		// onLoad 在页面， created 在组件
		onLoad() {
			this.getList()
		},
		async onReachBottom() {
			this.page++
			this.getList()
		},
		methods: {
			getList() {
				this.$api.get_list_mathematics({
					name: this.name,
					page: this.page,
					pageSize: this.pageSize
				}).then((res)=>{
					const {data} = res
					if (data.length === 0) {
						this.loadStatus = "noMore"
						this.loadModal = false
						return
					}
					let oldList = this.list || []
					oldList.push(...data)
					this.list = oldList
					this.loadModal = false
				})
			}
		}
	}
</script>

<style>
	
</style>
